#ifndef _EKOS_TRAP_H_
#define _EKOS_TRAP_H_

#include <types.h>

struct pushregs_t {
     /* registers as pushed by pusha */
     GPREG_T edi;
     GPREG_T esi;
     GPREG_T ebp;
     GPREG_T esp;		/* Useless */
     GPREG_T ebx;
     GPREG_T edx;
     GPREG_T ecx;
     GPREG_T eax;
};

struct stackframe_t
{
     GPREG_T  esp;
     SREG_T   ss;
     uint16_t padding;
};
     
struct trapframe_t {
     struct pushregs_t regs;

     SREG_T   es;
     uint16_t padding1;
     SREG_T   ds;
     uint16_t padding2;
     uint32_t num;
     /* below here defined by x86 hardware */
     uint32_t err;
     GPREG_T  eip;
     SREG_T   cs;
     uint16_t padding3;
     EFLAGS_T eflags;
     /* below here only when crossing rings, such as from user to kernel */
     struct stackframe_t stk;
};

#endif /* _EKOS_TRAP_H_ */
